//
// Created by Liming Shao on 11/3/2017.
//

#ifndef CHAPTER2_B035_H
#define CHAPTER2_B035_H

typedef struct Node{
    int value;
    struct Node* next;
}Node;

typedef struct DoubleNode{
    int value;
    struct DoubleNode *pre;
    struct DoubleNode *next;
}DoubleNode;

class B035 {
public:
    Node* removeLastKthNode(Node *head, int lastKth);
    DoubleNode* removeLastKthNode(DoubleNode *head, int lastKth);

    void test();

private:
    Node *addNode(Node *head, int value);
    DoubleNode *addNode(DoubleNode *head, int value);
    void printList(Node *head);
    void printList(DoubleNode *head);


};


#endif //CHAPTER2_B035_H
